namespace MetaProperties.SynchronizationContexts
{
    using System.Security.Permissions;
    using System.Threading;

    [SecurityPermission(SecurityAction.Demand, ControlThread = true)]
    public class SingleThreadSynchronizationContext : ThreadPoolSynchronizationContext
    {
        public SingleThreadSynchronizationContext()
            : this("STSC")
        {
        }

        public SingleThreadSynchronizationContext(string threadName) 
            : base(1, threadName)
        {
        }

        public override SynchronizationContext CreateCopy()
        {
            return this;
        }
    }
}